package com.zsw.alancomicserver.util;

import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;

public class FileUtil {

    /**
     * 文件保存到本地
     * @param file
     * @param fileDir 文件的保存路径
     * @throws IOException
     */
    public static void saveFile(MultipartFile file, String fileDir) throws IOException {
        String originFileName = file.getOriginalFilename();
        String newFileName = fileDir + originFileName;
        file.transferTo(new File(newFileName));
    }

}
